package WebCrawler

import "github.com/PuerkitoBio/goquery"

type WebPage struct {
	Host string
	Url  string

	Head   *WebHead
	Hrefs  map[string]*WebHref
	Texts  []*WebElement
	Images []*WebElement
}

type WebHead struct {
	Title       string
	Description string
	Keywords    []string
}

type WebHref struct {
	Href  string
	Title string
}

type WebElement struct {
	Tag       string
	Selection *goquery.Selection
	Text      string
}

func (e *WebElement) Clone() *WebElement {
	clone := &WebElement{
		Tag:       e.Tag,
		Selection: e.Selection,
		Text:      e.Text,
	}

	return clone
}

type Mode uint32

const (
	ModeContain = Mode(1) // 包含：字符串
	ModeEqual   = Mode(2) // 相同：字符串
	ModeRegexp  = Mode(3) // 正则表达式
	ModeElTag   = Mode(4) // 元素的类型
)

type Filter struct {
	Mode  Mode
	Param interface{}
}
